package com.kingsoft.dc.khaos.plugin.core.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;


public class ConfigUtils {
    static final Logger logger = LoggerFactory.getLogger(ConfigUtils.class);
    public static Properties pro = null;

    static {
        InputStream fs = null;
        try {
            pro = new Properties();
//            String file = ConfigUtils.class.getResource("/config.properties").getFile();
            fs = ConfigUtils.class.getClassLoader().getResourceAsStream("config.properties");
//            fs = new FileInputStream(file);
            pro.load(fs);

        } catch (IOException e) {
            logger.error("/config.properties is not found,"+ e.getMessage());
        } finally {
            if (fs != null) {
                try {
                    fs.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public static Properties init() {
        return pro;
    }
}
